package gui;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class PopUpSettingsFrame extends JFrame {



	/**
	 * 
	 */
	private static final long serialVersionUID = -2135794950938142848L;
	private ServerMainFrame serverMainFrame;
	private JPanel connectionInfoPanel;

	public PopUpSettingsFrame(ServerMainFrame serverMainFrame) {
		this.serverMainFrame = serverMainFrame;
		this.initGUI();
	}

	private void initGUI() {
		setTitle("Server Settings");
		setSize(300, 200);
		this.setLayout(new FlowLayout());
	    setLocationRelativeTo(null);
	    this.setVisible(true);
	    setupConnectionInfoPanel();
	    setupOkButton();
		
	}

	private void setupOkButton() {
		JButton btnOk = new JButton("Okay");
		this.getContentPane().add(btnOk);
		btnOk.setBounds(110, 100, 80, 30);
		btnOk.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent arg0) {
				PopUpSettingsFrame.this.dispose();
				
			}
		});
	}

	private void setupConnectionInfoPanel() {
		this.connectionInfoPanel = new JPanel();
		this.getContentPane().add(connectionInfoPanel);
		connectionInfoPanel.setLayout(new FlowLayout());
		connectionInfoPanel.setVisible(true);
		connectionInfoPanel.setBounds(30, 30, 80, 30);
		JLabel txtInfo = new JLabel();
		txtInfo.setText(serverMainFrame.getConnectionInfo());
		connectionInfoPanel.add(txtInfo);
		
		
	}
	
	

}
